<?php
   
/**
 * Mapper for tprotections
 * 
 * @author Martin Grossmann <snake.aas@gmail.com>
 * @version 1.0
 * @package Mappers
 *
 * @property string $Protection Access control list. 10 chars max
 * @property string $Description Short description. 255 chars max
 * 
 * @entity
 * @table(name="tprotections")
 */     
class Protection {
  /**
   * Access control list
   * 
   * @access private
   * @var string
   * 
   * @Id 
   * @column(name="Protection", type="string", length=10)
   */
   private $protection;
     
  /**
   * Short description
   * 
   * @access private
   * @var string
   * 
   * @column(name="Description", type="string", length=255, nullable=true)
   */
   private $description;
     

  public function __get($name) {
    
    switch($name) {
      case "Protection": 
        return $this->protection;
        break;
    
      case "Description": 
        return $this->description;
        break;
      
      default: 
        throw new EntityException(sprintf(T_("Trying to get undefined property")." ", $name));
    }
  }
  
  public function __set($name, $value) {  
    
    switch($name) {
      case "Protection": 
        $this->protection = Validations::validateString($value, 10, null, false);
        break; 

      case "Description": 
        $this->description = Validations::validateString($value, 255, null, true);
        break; 

      default: 
        throw new EntityException(sprintf(T_("Trying to set undefined property")." ", $name));
    }
  }  
  
  public function __construct() {
    
  }
  
}